//
//  MCWithdrawMoneyHeaderView.swift
//  StoreManage
//
//  Created by MC on 2017/12/27.
//  Copyright © 2017年 MC. All rights reserved.
//

import UIKit

class MCWithdrawMoneyHeaderView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        
        self.addSubview(bgImageView)
        bgImageView.snp.remakeConstraints { (make) ->Void in
            make.left.right.top.equalTo(self)
            make.height.equalTo(MCScreenWidth/3)
        }
        
        bgImageView.addSubview(iconImageView)
        iconImageView.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.centerY.equalTo(bgImageView)
            make.size.equalTo(CGSize.init(width: 60, height: 60))
        }
        
        bgImageView.addSubview(nameLabel)
        nameLabel.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(iconImageView.snp.right).offset(5)
            make.centerY.equalTo(bgImageView)
        }
        
        bgImageView.addSubview(moneyLabel)
        moneyLabel.snp.remakeConstraints { (make) ->Void in
            make.right.equalTo(bgImageView).offset(-15)
            make.centerY.equalTo(iconImageView)
        }
        
        self.addSubview(lineOneView)
        lineOneView.snp.remakeConstraints { (make) ->Void in
            make.left.right.equalTo(self)
            make.top.equalTo(bgImageView.snp.bottom)
            make.height.equalTo(5)
        }

        
        self.addSubview(recordButton)
        recordButton.snp.remakeConstraints { (make) ->Void in
            make.left.equalTo(15)
            make.top.equalTo(lineOneView.snp.bottom)
            make.height.equalTo(50)
        }
        
        self.addSubview(lineTwoView)
        lineTwoView.snp.remakeConstraints { (make) ->Void in
            make.left.right.equalTo(self)
            make.top.equalTo(recordButton.snp.bottom)
            make.height.equalTo(5)
        }

        self.frame = CGRect.init(x: 0, y: 0, width: 0, height: MCScreenWidth/3 + 60)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    lazy var bgImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = #imageLiteral(resourceName: "Reuse_bgImage")
        return imageView
    }()
    
    lazy var iconImageView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = #imageLiteral(resourceName: "Reuse_placeholder_1_1")
        imageView.layer.masksToBounds = true
        imageView.layer.cornerRadius = 30
        imageView.layer.borderColor = UIColor.MCGray_light.cgColor
        imageView.layer.borderWidth = 1
        return imageView
    }()
    
    
    lazy var nameLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(13)
        label.numberOfLines = 0
        label.textColor = UIColor.white
        label.text = "账号：\n0"
        return label
    }()
    
    lazy var moneyLabel: UILabel = {
        let label = UILabel()
        label.font = MCFont(15)
        label.textColor = UIColor.white
        label.text = "账户余额: 0"
        return label
    }()
    
    lazy var recordButton: UIButton = {
        let button = UIButton.init(type: UIButtonType.custom)
        button.titleLabel?.font = MCFont(14)
        button.setTitleColor(UIColor.black, for: UIControlState.normal)
        button.setTitle(" 提现记录", for: UIControlState.normal)
        button.setImage(#imageLiteral(resourceName: "Store_record"), for: UIControlState.normal)
  //      button.addTarget(self, action: #selector(recordButtonClicked), for: UIControlEvents.touchUpInside)
        return button
    }()
    
    lazy var lineOneView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()
    
    lazy var lineTwoView: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor.MCGray_light
        return view
    }()

}
